namespace ASPNET.UserControls
{
    using ASPNET.StarterKit.IssueTracker.BusinessLogicLayer;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class PickMilestone : UserControl
    {
        private MilestoneCollection _DataSource;
        private bool _DisplayDefault;
        [AccessedThroughProperty("dropMilestone")]
        private DropDownList _dropMilestone;
        [AccessedThroughProperty("reqVal")]
        private RequiredFieldValidator _reqVal;
        private object designerPlaceholderDeclaration;

        public PickMilestone()
        {
            base.Init += new EventHandler(this.Page_Init);
            this._DisplayDefault = false;
        }

        public override void DataBind()
        {
            this.dropMilestone.Items.Clear();
            this.dropMilestone.DataSource = this._DataSource;
            this.dropMilestone.DataTextField = "Name";
            this.dropMilestone.DataValueField = "Id";
            this.dropMilestone.DataBind();
            if (this._DisplayDefault)
            {
                this.dropMilestone.Items.Insert(0, new ListItem("-- Select Milestone --", "0"));
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
        }

        private void Page_Init(object sender, EventArgs e)
        {
            this.InitializeComponent();
        }

        public MilestoneCollection DataSource
        {
            get
            {
                return this._DataSource;
            }
            set
            {
                this._DataSource = value;
            }
        }

        public bool DisplayDefault
        {
            get
            {
                return this._DisplayDefault;
            }
            set
            {
                this._DisplayDefault = value;
            }
        }

        protected virtual DropDownList dropMilestone
        {
            get
            {
                return this._dropMilestone;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                if (this._dropMilestone != null)
                {
                }
                this._dropMilestone = value;
                if (this._dropMilestone != null)
                {
                }
            }
        }

        public bool Enabled
        {
            get
            {
                return this.dropMilestone.Enabled;
            }
            set
            {
                this.dropMilestone.Enabled = value;
            }
        }

        public bool Required
        {
            get
            {
                return this.reqVal.Visible;
            }
            set
            {
                this.reqVal.Visible = value;
            }
        }

        protected virtual RequiredFieldValidator reqVal
        {
            get
            {
                return this._reqVal;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                if (this._reqVal != null)
                {
                }
                this._reqVal = value;
                if (this._reqVal != null)
                {
                }
            }
        }

        public int SelectedValue
        {
            get
            {
                return int.Parse(this.dropMilestone.SelectedValue);
            }
            set
            {
                try
                {
                    this.dropMilestone.SelectedValue = value.ToString();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    ProjectData.ClearProjectError();
                }
            }
        }
    }
}

